{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "997a4ca5",
   "metadata": {},
   "source": [
    "# Linux-Centos7下安装Anaconda，conda 安装虚拟环境，cuda,cudnn\n",
    "\n",
    "\n",
    "[**原贴地址-CSDN**](https://blog.csdn.net/qq_15821487/article/details/123248571)\n",
    "\n",
    "\n",
    "[其他博客-1](https://blog.csdn.net/LIWEI940638093/article/details/113811563)\n",
    "\n",
    "\n",
    "[歪门博客-2](https://blog.csdn.net/qq_42642142/article/details/125820514)\n",
    "\n",
    "\n",
    "## 安装 anaconda 略\n",
    "\n",
    "## 在conda虚拟环境中安装cuda和cudnn\n",
    "本文以cuda10.1为例：\n",
    "在conda虚拟环境中安装CUDA：\n",
    "\n",
    "```python\n",
    "conda install cudatoolkit=10.1 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/\n",
    "\n",
    "```\n",
    "\n",
    "或者 \n",
    "```python\n",
    "conda install cudatoolkit=10.1\n",
    "```\n",
    "\n",
    "在conda虚拟环境中安装cudnn：\n",
    "\n",
    "```python\n",
    "conda install cudnn=7.6.5 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/\n",
    "```\n",
    "\n",
    "或者：\n",
    "\n",
    "```python\n",
    "conda install cudnn=7.6.5\n",
    "```\n",
    "\n",
    "不写版本会自动选版本与cuda版本相匹配：\n",
    "\n",
    "```python\n",
    "conda install cudnn\n",
    "```\n",
    "\n",
    "这里的安装路径没有单独形成cuda文件夹，都是统一存放在envs/你的虚拟环境/lib or include 文件夹下：\n",
    "下图展示的就是安装CUDA和CUDNN以后的路径。\n",
    "这里的安装路径没有单独形成cuda文件夹，都是统一存放conda安装目录的在envs下的虚拟环境lib、include文件夹下。\n",
    "\n",
    "```python\n",
    "cd /data/anaconda3/envs/py38_insightface\n",
    "```\n",
    "![info](pic/101.png)\n",
    "\n",
    "添加CUDA进入环境变量\n",
    "\n",
    "多个虚拟环境只要添加一次就好了\n",
    "\n",
    "```python\n",
    "vim /etc/profile\n",
    "```\n",
    "\n",
    "\n",
    "```python\n",
    "PATH=$PATH:/data/anaconda3/envs/python38/lib\n",
    "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/anaconda3/envs/python38/lib\n",
    "export PATH\n",
    "export LD_LIBRARY_PATH \n",
    "```\n",
    "\n",
    "\n",
    "```python\n",
    "source /etc/profile\n",
    "```\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "04b33643",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "63766cb1",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "605ed4f5",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3345e813",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b85c2eec",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5971d5d8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3f64fca5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
